package com.algorithm;

import java.math.BigDecimal;

/**
 * @author : fujc-dev@qq.com
 */

public class Programs {

    public static void main(String[] args) {
        double a = 1.100;
        String s1 = "1.100";

        BigDecimal data1 = new BigDecimal(a);
        BigDecimal data2 = new BigDecimal(s1);

        System.out.println(data1.toString());
        System.out.println(data2.toString());



        //System.out.print(compare(data1, data2));
    }

    public static String compare(BigDecimal val1, BigDecimal val2) {
        String result = "";
        if (val1.compareTo(val2) < 0) {
            result = "第二位数大！";
        }

        if (val1.compareTo(val2) == 0) {
            result = "两位数一样大！";
        }

        if (val1.compareTo(val2) > 0) {

            result = "第一位数大！";

        }

        return result;
    }

}
